# coding=utf-8
import HTMLTestRunner_cn
import os
import unittest
import time

from testsuites.test_eports_login import EportsLogin
from testsuites.test_eports_order_list import EportsOrderDetail

# 设置报告文件保存路径
report_path = os.path.dirname(os.path.abspath('.')) + '/test_report/'
print
# 获取系统当前时间
now = time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time()))

# 设置报告名称格式
HtmlFile = report_path + now + "HTMLtemplate.html"
fp = open(HtmlFile, "wb")

# 构建suite
# suite = unittest.TestLoader().discover("testsuites")
# suite = unittest.TestSuite(unittest.makeSuite(EportsLogin))
suite = unittest.TestSuite(unittest.makeSuite(EportsOrderDetail))
# 构造测试集
# suit = unittest.TestSuite()
# 把这个类中需要执行的测试用例加进去，有多条再加即可,从上到下先后顺序
# suit.addTest(EportsLogin('test_eports_login'))
# suit.addTest(test_customer_manage("test_customer_add"))

if __name__ == '__main__':

    # 初始化一个HTMLTestRunner实例对象，用来生成报告
    runner = HTMLTestRunner_cn.HTMLTestRunner(stream=fp, title=u"商家中心产品测试报告", description=u"用例测试情况")

    # 开始执行测试套件
    runner.run(suite)